function loadContent (id) {
    var album_id = (typeof(id) == 'undefined') ? '' : id;

    var transId = Ext.Ajax.request({
        url: _webroot+'/albums/eventForm/'+album_id,
        method: 'POST',
        success: function(response, opts) {
            Ext.fly('album-wrap').fadeIn().update(response.responseText);
        },
        failure: function(response, opts) {
            message('server-side failure with status code '+response.status);
        },
        callback: function() {
            Ext.fly('status').slideOut('t', {
                easing: 'easeOut',
                useDisplay: true
            });
        }
    });

    if (Ext.Ajax.isLoading(transId)) {
        Ext.fly('status').update('Loading..');
        Ext.fly('status').slideIn('t', { easing:'easeOut' });
    }
} // loadContent

function save () {
    var message = Ext.get('message');

    if (validation('form-album') == false) {
        message.update('Please enter title.');
        message.addClass('error').highlight();
        return false;
    }

    transId = Ext.Ajax.request({
        form: 'form-album',
        success: function(response, opts) {
            var obj = Ext.decode(response.responseText);
            if (obj.status == false) {
                if (obj.mesg) {
                    message.update(obj.mesg);
                    message.addClass('error').slideIn().highlight();
                }
            } else {
                Ext.fly('album-id').dom.value = obj.id;
                Ext.fly('album_id').dom.value = obj.id;

                if (obj.mesg) {
                    message.hide().update(obj.mesg);
                    message.addClass('success').slideIn().highlight().pause(5).slideOut('t', { useDisplay:true });
                }
                if (!Ext.fly('upload-wrap').isVisible()) {
                    Ext.fly('tab2').addClass('enabled');
                    Ext.fly('tab3').addClass('enabled');
                    Ext.fly('form-upload').dom.action += obj.id;
                    initUpload();
                    gotoTab(2);
                    /*Ext.fly('upload-wrap').pause(1).slideIn('t', {
                        easing: 'easeOut'
                    });*/
                }
            }
        },
        failure: function(response, opts) {
            message('server-side failure with status code '+response.status);
        },
        callback: function() {
            Ext.fly('status').slideOut('t', {
                easing: 'easeOut',
                useDisplay: true
            });
            Ext.each(Ext.query('input[type=submit],input[type=button]', 'form-album'), function(e){ e.disabled = false; });
        }
    });

    if (Ext.Ajax.isLoading(transId)) {
        Ext.each(Ext.query('input[type=submit],input[type=button]', 'form-album'), function(e){ e.disabled = true; });
        Ext.fly('status').update('Saving..');
        Ext.fly('status').slideIn('t', {
            easing: 'easeOut'
        });
    }

    return false;
} // save